<div class="modal-content">
  <div class="modal-header">
    <button type="button" class="close" (click)="btnCloseClick()"><span aria-hidden="true">&times;</span><span
      class="sr-only">Close</span>
    </button>
    <h3 class="modal-title text-center">{{title}}</h3>
  </div>
  <div class="modal-body">
    <form>
      <div *ngIf="!isAdd" class="form-group row">
        <label class="col-lg-2 col-form-label"> ID: </label>
        <div class="col-lg-10">
          <input type="number" class="form-control" [value]="user.id" disabled/>
        </div>
      </div>
      <div [class]="isNameError ? 'form-group row has-error' : 'form-group row'"><label class="col-lg-2 col-form-label">
        用户名: </label>
        <div class="col-lg-10">
          <input type="text" (blur)="checkName()" name="name" class="form-control"
                 [value]="user.name" [disabled]="!isAdd" [(ngModel)]="user.name"/>
          <p *ngIf="isAdd && isNameError" class="text-danger">{{nameErrorMsg}}</p>
        </div>
      </div>
      <div class="form-group row"><label class="col-lg-2 col-form-label"> 中文名: </label>
        <div class="col-lg-10"><input type="text" class="form-control" name="chsname" [(ngModel)]="user.chsname"
                                      [value]="user.chsname"/></div>
      </div>
      <div class="form-group row"><label class="col-lg-2 col-form-label"> 邮箱: </label>
        <div class="col-lg-10"><input type="email" class="form-control" name="email" [(ngModel)]="user.email"
                                      [value]="user.email"/></div>
      </div>
      <div *ngIf="isAdd" class="form-group row"><label class="col-lg-2 col-form-label"> 密码: </label>
        <div class="col-lg-10"><input type="password" class="form-control" name="password" [(ngModel)]="user.password"
                                      [value]="user.email"/></div>
      </div>
      <div *ngIf="isAdd" [class]="isConfirm ? 'form-group row' : 'form-group row has-error'"><label
        class="col-lg-2 col-form-label"> 确认密码: </label>
        <div class="col-lg-10">
          <input type="password" class="form-control" name="confirmValue" (blur)="confirmPasswd()"
                 [value]="confirmValue" [(ngModel)]="confirmValue"/>
          <p *ngIf="!isConfirm" class="text-danger">密码不一致</p>
        </div>
      </div>
      <div class="form-group row"><label class="col-lg-2 col-form-label"> 状态: </label>
        <div class="col-lg-10">
          <ui-switch [checked]="user.status==1" (change)="statusChange($event)">

          </ui-switch>
        </div>
      </div>
    </form>
  </div>

  <div class="modal-footer">
    <button type="button" class="btn btn-white" (click)="btnCloseClick()">取消</button>
    <button [disabled]="this.isAdd && (!this.isConfirm || this.errorMsg || this.isNameError)"
            type="button" class="btn btn-primary"
            (click)="btnConfirmClick()">保存
    </button>
  </div>
</div>
